var path = require('path');

var webpack = require('webpack');

var htmlWebpackPlugin = require('html-webpack-plugin');

const VueLoaderPlugin = require('vue-loader/lib/plugin');

// const cssLoader = require("style-loader!css-loader!./style.css");
module.exports = {
    entry: path.resolve(__dirname, './src/main.js'),
    output: {
        path: path.resolve(__dirname, './dist'),
        filename: 'bundle.js'
    },
    devServer: {
        // host: '10.167.199.44',
        host: 'localhost',
        inline: true,
        open: true,
        port: 3000,
        contentBase: 'src',
        hot: true,
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new htmlWebpackPlugin({
            template: path.resolve(__dirname, 'src/index.html'),//模板路径
            filename: 'index.html'        //自动生成的HTML文件的名称
        }),
        new VueLoaderPlugin()
    ],
    module: {
        rules: [
            {test: /\.css$/, use: ['style-loader', 'css-loader']},
            { test: /\.(jpg|png|gif|bmp|jpeg)$/, use: 'url-loader' }, // 配置图片路径loader
            {test:/\.vue$/,use:"vue-loader"},
            {
                test:/\.js$/,
                loader:'babel-loader',
                exclude:/node_modules/,
                query:{
                    "presets":['es2015'],
                    plugins:['transform-runtime']
                }
            },

            // { test: /\.css$/, loader: 'style-loader!css-loader' },
            { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, use: "file" },
            { test: /\.(woff|woff2)$/, use:"url?prefix=font/&limit=5000" },
            { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, use: 'url-loader' },
            // { test: /\.scss$/, use: 'scss-loader' },
            // { test: /\.js$/, use: 'url-loader' },
            { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, use: "url?limit=10000&mimetype=image/svg+xml" }
        ],



        // resolve: {
        //     alias:{//设置vue被导入时候的包的路径
        //         // "vue$":"vue/dist/vue.js"
        //     }
        // }
    }

}